package gewu.suleju.util;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.stereotype.Component;

@Component
public class MailUtil {

    @Autowired
    private JavaMailSender mailSender;

    public void sendMail(String toMail,String code){
        SimpleMailMessage msg = new SimpleMailMessage();

        msg.setSubject("东油验证码");
        //msg.setFrom("849962874@qq.com");
        msg.setFrom("2312578438@qq.com");
        //主题
        msg.setText(code);

        msg.setTo(toMail);

        mailSender.send(msg);
    }

}